import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '部门',
    align:"center",
    dataIndex: 'orgCode_dictText'
   },
//    {
//     title: '是否小组违规;0/否；1/是',
//     align:"center",
//     dataIndex: 'groupViolation'
//    },
//    {
//     title: '小组名称',
//     align:"center",
//     dataIndex: 'groupName'
//    },
   {
    title: '姓名',
    align:"center",
    dataIndex: 'realname'
   },
   {
    title: '联系电话',
    align:"center",
    dataIndex: 'phone'
   },
   {
    title: '所在席位',
    align:"center",
    dataIndex: 'seatId_dictText'
   },
   {
    title: '违规类型',
    align:"center",
    dataIndex: 'violationType_dictText'
   },
   {
    title: '违规时间',
    align:"center",
    dataIndex: 'violationTime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
    label: '姓名',
    field: 'realname',
    component: 'JInput',
  },
  {
    label: '联系电话',
    field: 'phone',
    component: 'JInput',
  },
  {
    label: '角色',
    field: 'roleCode',
    component: 'JDictSelectTag',
    componentProps: ({ formModel, formActionType }) => {
      return {
        dictCode: 'sys_role,role_name,role_code,role_code!="admin"',
      }
    },
  },
  {
    label: '违规类型',
    field: 'violationType',
    component: 'JDictSelectTag',
    componentProps: ({ formModel, formActionType }) => {
      return {
        dictCode: 'violation_type',
      }
    },
  },
  {
    label: '违规时间',
    field: 'violationTime',
    component: 'DatePicker',
    componentProps: ({ formModel, formActionType }) => {
      return {
        format: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD'
      }
    },
  },
  {
      label: '席位',
      field: 'seatId',
      component: 'JDictSelectTag',
      componentProps: ({ formModel, formActionType }) => {
        return {
          dictCode: 'gbiac_seat,name,id',
        }
      },
    },
  {
    label: '部门',
    field: 'orgCode',
    component: 'JDictSelectTag',
    componentProps: ({ formModel, formActionType }) => {
      return {
        dictCode: 'sys_depart,depart_name,org_code,org_code like "A01A%"',
      }
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '部门',
    field: 'orgCode_dictText',
    component: 'Input',
  },
//   {
//     label: '是否小组违规;0/否；1/是',
//     field: 'groupViolation',
//     component: 'Input',
//     dynamicRules: ({model,schema}) => {
//           return [
//                  { required: true, message: '请输入是否小组违规;0/否；1/是!'},
//           ];
//      },
//   },
//   {
//     label: '小组名称',
//     field: 'groupName',
//     component: 'Input',
//   },

  {
    label: '姓名',
    field: 'realname',
    component: 'Input',
  },
  {
    label: '联系电话',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '所在席位',
    field: 'seatId_dictText',
    component: 'Input',
  },

  {
    label: '违规类型',
    field: 'violationType_dictText',
    component: 'Input',
  },
  {
    label: '违规时间',
    field: 'violationTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },

	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  tenantId: {title: '租户号',order: 0,view: 'text', type: 'string',},
  orgCode: {title: '部门编码',order: 2,view: 'text', type: 'string',},
  violationType: {title: '违规类型;leave/离岗；sleep/睡岗；phone/玩手机；leave_group/小组无人在岗；',order: 3,view: 'text', type: 'string',},
  groupViolation: {title: '是否小组违规;0/否；1/是',order: 4,view: 'text', type: 'string',},
  groupName: {title: '小组名称',order: 5,view: 'text', type: 'string',},
  userId: {title: '用户id',order: 6,view: 'text', type: 'string',},
  username: {title: '用户名',order: 7,view: 'text', type: 'string',},
  realname: {title: '真实姓名',order: 8,view: 'text', type: 'string',},
  phone: {title: '电话',order: 9,view: 'text', type: 'string',},
  userType: {title: '用户类型;用户类型：teacher/教员；student/学员；user/普通用户；',order: 10,view: 'text', type: 'string',},
  seatId: {title: '席位id',order: 11,view: 'text', type: 'string',},
  violationTime: {title: '违规时间',order: 12,view: 'datetime', type: 'string',},
  roleCode: {title: '角色编码',order: 13,view: 'text', type: 'string',},
  roleName: {title: '角色名称',order: 14,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
